package cn.wolfcode.productServer.web.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope       // 贴该注解实现配置动态刷新
public class NacosConfigController {
    @Value("${avAppConfig.name}")
    private String avAppConfigName;
    @Value("${env}")
    private String env;
    @Value("${redisConfig}")
    private String redisConfig;

    @RequestMapping("/nacosConfig")
    public String nacosConfig(){
        return "远程信息:"+avAppConfigName;
    }

    @RequestMapping("/nacosConfigEnv")
    public String nacosConfig2(){
        return "公共配置:" + avAppConfigName + ",环境配置信息:" + env;
    }

    @RequestMapping("/nacosConfigRedis")
    public String nacosConfig3(){
        return "公共配置:" + avAppConfigName + ",环境配置信息:" + env + ",全局配置-redis端口:" + redisConfig;
    }
}